<template>
	<!-- 商家让利 爆品 -->
	<view class="container bdr20  mt20 df aicn jcsb">
		<view class="title-box df aic jcc">
			<image
				src="https://zhaimeibianli.oss-cn-hangzhou.aliyuncs.com/house/2024/07/16/930c8e3de8184865a90dfbc7fb6b1de6.png"
				style="width: 64rpx;height: 74rpx;display: inline-block;"></image>
		</view>
		<view class="" style="width: 594rpx;">
			<swiper :disable-touch="false" autoplay  vertical circular interval="4000" class="u-swiper">
				<!-- {{Math.ceil(list.length%4)}} -->
				<swiper-item v-for="(item, index) in list" v-if="(Math.ceil(list.length%4) > 0 && index<=Math.ceil(list.length%4)) || (Math.ceil(list.length%4) == 0 && index < list.length/4) " :key="index" class="swiper-item df aic jcsb">
					<view class="price_item df aic fs24 jcsa" v-for="_item in list.slice(index*4,index*4+4)">
						<view class="c3 fs24 fwb title u-line-1">{{_item.subjectName}}</view>
						<view><text class="price fwb">{{_item.minPrice||'0.00'}}</text>元/{{_item.referenceUnit}}</view>
						<!--  v-if="_item.minPrePrice!=-1" -->
						<!-- <view class="df aic " :style="{'color':subPrice(_item)<=0?'#17AF38':'#EF2929'}">
								<template >
									<u-icon name="arrow-downward" v-if="subPrice(_item)<=0"></u-icon>
									<u-icon name="arrow-upward" v-else></u-icon>
								</template>
								<text class=" fwb">{{Math.abs(subPrice(_item))}}</text>
						</view> -->
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
import Decimal from 'decimal.js'
	export default {
		props: {
			list:{
				type:Array,
				default:() => []
			}
		},
		methods: {
			handleDetail(item) {
				uni.navigateTo({
					url: `/other/pages/dailySaleList?id=${item.platformGoodsSpecMixId}&sessionTime=${item.sessionTime}`
				})
			}
		},
		methods:{
			subPrice(item){
				return new Decimal(item.minPrePrice).sub(item.maxPrePrice).toFixed(2)||0
			}
		},
		data() {
			return {
			
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		background: #FFFAF2;
		height: 100rpx;

		.title-box {
			border-radius: 20rpx 0rpx 0rpx 20rpx;
			background: linear-gradient(90deg, #FD7F21 0%, #FDC472 100%);
			height: 100rpx;
			font-weight: 400;
			width: 96rpx;
		}
		.u-swiper {
			.swiper-item{
				flex-wrap: wrap;
			}
			height: 100rpx;
			padding:0 12rpx;
			.price_item{
				width: 50%;
				.title{
					max-width: 150rpx;
				}
				.specName{
					
				}
			}
		}
	}
</style>